﻿using AspectCore.DynamicProxy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebApplicationAOPNetCore
{
    public class CustomFilterAttribute:AbstractInterceptorAttribute
    {
        public async override Task Invoke(AspectContext context, AspectDelegate next)
        {
            try
            {
                Console.WriteLine($"方法执行前。。");
                await next(context);
            }
            catch (Exception ex)
            {

                Console.WriteLine($"执行方法发生错误：{ex.Message}");
                throw;
            }
            finally
            {
                Console.WriteLine($"方法执行完毕");
            }
        }
    }
}
